package cn.com.czpb.client.module.subscribe.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 猪猪侠 on 2017/8/15.
 */

public class SubscribeFragmentPagerAdapter extends FragmentPagerAdapter {
    private String[] titles = {"文章","简介"};
    private List<Fragment> fragmentList;

    public SubscribeFragmentPagerAdapter(FragmentManager fm) {
        super(fm);
        fragmentList = new ArrayList<>();
    }

    public void setFragmentList(List<Fragment> list){
        this.fragmentList =list;
        notifyDataSetChanged();
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
